Introduce IndexPager::preprocessResults(); useful for doing batch existence checks...
authorRob Church <robchurch@users.mediawiki.org>
Wed, 18 Jul 2007 09:29:41 +0000 (09:29 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Wed, 18 Jul 2007 09:29:41 +0000 (09:29 +0000)
includes/Pager.php

index 0dc29e3..601c9a5 100644 (file)
@@ -107,6 +107,9 @@ abstract class IndexPager implements Pager {
                $this->mResult = $this->reallyDoQuery( $this->mOffset, $queryLimit, $descending );
                $this->extractResultInfo( $this->mOffset, $queryLimit, $this->mResult );
                $this->mQueryDone = true;
+               
+               $this->preprocessResults( $this->mResult );
+               $this->mResult->rewind(); // Paranoia
 
                wfProfileOut( $fname );
        }
@@ -192,6 +195,13 @@ abstract class IndexPager implements Pager {
                return new ResultWrapper( $this->mDb, $res );
        }
 
+       /**
+        * Pre-process results; useful for performing batch existence checks, etc.
+        *
+        * @param ResultWrapper $result Result wrapper
+        */
+       protected function preprocessResult( $result ) {}
+
        /**
         * Get the formatted result list. Calls getStartBody(), formatRow() and 
         * getEndBody(), concatenates the results and returns them.